set more off
global projectdir "/projects/old_9802_v2"
global rawdata "$projectdir/data/raw_pulls/umetrics/FSRDC_2018"

cd "$rawdata"
use usiris_emnmxwalk_2018q4a_2018q4a, clear
keep emplid pik
drop if missing(pik)
tempfile umetrics_piks
save `umetrics_piks'

** Employee
use "$rawdata/um_iris_uer_2018_remp_rsch.dta", clear
gen emplid = empnumber
merge m:1 emplid using `umetrics_piks', update
drop if _merge==2
drop _merge

drop if missing(pik)
drop emplid empnumber
rename pik empnumber

rename institutionid  institution_id 
rename empnumber emp_number
rename uniqueawardnumber unique_award_number
rename fedawdnumstd fed_awd_num_std
rename periodstartdate period_start_date
rename periodenddate period_end_date
rename recipientaccountnumber recipient_account_number
rename objectcode object_code
rename jobtitle job_title
rename occupationalclass occupational_class
rename umetricsoccupationalclass umetrics_occupational_class
rename soccode soc_code
rename ftestatus fte_status
rename proportionearningsallocated proportion_earnings_allocated

save "$rawdata/core_employee2019q1_pik.dta", replace 
